home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / initMainWindow.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  11.4 KB  |  350 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Aug 15 1996
  22. //
  23. //  Description:
  24. //      This procedure creates the main maya window.
  25. //
  26. {
  27.  
  28.     global string $gUIpathDiv;
  29.  
  30.     global string $gMainWindow;
  31.     global string $gMainWindowForm;
  32.     global string $gStatusLineForm;
  33.     global string $gShelfForm;
  34.     global string $gWorkAreaForm;
  35.     global string $gMainPane;
  36.     global string $gToolboxForm;
  37.     global string $gTimeSliderForm;
  38.     global string $gPlaybackRangeForm;
  39.     global string $gCommandLineForm;
  40.     global string $gHelpLineForm;
  41.     global string $gAttributeEditorForm;
  42.     global string $gToolSettingsForm;
  43.     global string $gChannelsLayersForm;
  44.     global string $gMayaLiveControlForm;
  45.  
  46.     //    These globals track the visibility of the corresponding window
  47.     //    component.  Whenever a toggleUIComponentVisibility("Component") call
  48.     //    is made these values are updated.  Set all these flags to be
  49.     //    initially visible, they will be updated accordingly when each
  50.     //    component is initialized and their startup preferences are
  51.     //    loaded.
  52.     // 
  53.     global int    $gStatusLineVisible      = 1;
  54.     global int    $gShelfVisible           = 1;
  55.     global int    $gToolboxVisible         = 1;
  56.     global int    $gTimeSliderVisible      = 1;
  57.     global int    $gPlaybackRangeVisible   = 1;
  58.     global int    $gCommandLineVisible     = 1;
  59.     global int    $gHelpLineVisible        = 1;
  60.     global int    $gAttributeEditorVisible = 1;
  61.     global int    $gToolSettingsVisible    = 1;
  62.     global int    $gChannelsLayersVisible  = 1;
  63.  
  64.     //    Default size of window is full screen.
  65.     //
  66.     int $top = 33;
  67.     int $left = 9;
  68.     int $width = 1262;
  69.     int $height = 982;
  70.  
  71.     if (`about -nt`) {
  72.         // window size/position is non-client size.
  73.         $top =  0;
  74.         $left = 0;
  75.         $width = 1280;
  76.         $height = 1024;
  77.     }
  78.  
  79.     if (`about -mac`) {
  80.         // default to a 1024 x 768 display
  81.         //
  82.         $top =  0;
  83.         $left = 0;
  84.         $width = 1024;
  85.         // allow space for the title bar and the dock
  86.         //
  87.         $height = 768 - 24 - 72;
  88.     }
  89.  
  90.     //    Read in the preference values.
  91.     //
  92.     int $useTitleBar = `optionVar -q mainWindowTitleBarVis`;
  93.     int $menubarVis = `optionVar -q mainWindowMenubarVis`;
  94.  
  95.     //    Create the main Maya window.
  96.     //
  97.     if ( `about -evalVersion` ) {
  98.         $gMainWindow = `window 
  99.             -retain
  100.             -mainWindow
  101.             -menuBar        true
  102.             -menuBarVisible $menubarVis
  103.             -topLeftCorner  $top $left 
  104.             -widthHeight    $width $height
  105.             -titleBar       $useTitleBar
  106.             -title          "Maya Personal Learning Edition" 
  107.             -iconName       "Maya Personal Learning Edition" 
  108.             "MayaWindow"`;
  109.     } else {
  110.     $gMainWindow = `window 
  111.         -retain
  112.         -mainWindow
  113.         -menuBar        true
  114.         -menuBarVisible $menubarVis
  115.         -topLeftCorner  $top $left 
  116.         -widthHeight    $width $height
  117.         -titleBar       $useTitleBar
  118.         -title          "Maya" 
  119.         -iconName       "Maya" 
  120.         "MayaWindow"`;
  121.     }
  122.  
  123.     //  if a title bar was specified, annotate it so that it
  124.     //  will always display the current file and selected object.
  125.     //
  126.     if ( $useTitleBar ){
  127.         showSelectionInTitle "MayaWindow";
  128.     }
  129.  
  130.     // ------------------------------------------------------------
  131.     //    Top level form.
  132.     // ------------------------------------------------------------
  133.  
  134.     //  Create the top level layout for the main Maya window.
  135.     //
  136.     $gMainWindowForm = `formLayout mayaMainWindowForm`;
  137.  
  138.     // ------------------------------------------------------------
  139.     //    Horizontal components, ie. those across the top and bottom
  140.     //    of the main layout.
  141.     // ------------------------------------------------------------
  142.  
  143.     //    The Status line.
  144.     //
  145.     $statusLine = `formLayout -parent $gMainWindowForm`;
  146.  
  147.     //    The Shelf and Toolbox.
  148.     //
  149.     $shelf = `formLayout -parent $gMainWindowForm`;
  150.  
  151.     //    The Work area.  This contains the main view panes, the 
  152.     //    Attribute Editor, and the Channel Box.
  153.     //
  154.     $gWorkAreaForm = `formLayout -parent $gMainWindowForm`;
  155.  
  156.     //    The Time slider.
  157.     //
  158.     //    NOTE that the name of this form is TimeSliderForm. This is
  159.     //    referenced from mlControlPanel.mel. If you change it here
  160.     //    you must change it there. Maya Live needs to insert a 
  161.     //    panel of controls above the Time Slider and below the work
  162.     //    area.
  163.     //
  164.     $timeSlider = `formLayout -parent $gMainWindowForm TimeSliderForm`;
  165.  
  166.     //    The Playback range.
  167.     //
  168.     $playbackRange = `formLayout -parent $gMainWindowForm`;
  169.  
  170.     //    The Command line.
  171.     //
  172.     $commandLine = `formLayout -parent $gMainWindowForm`;
  173.  
  174.     //    The Help line.
  175.     //
  176.     $helpLine = `formLayout -parent $gMainWindowForm`;
  177.  
  178.     //    Maya Live Control Panel.
  179.     //
  180.     $mayaLive = `formLayout -parent $gMainWindowForm`;
  181.  
  182.     // ------------------------------------------------------------
  183.     //    Vertical components, ie. the left and right side components
  184.     //    as well as the main work area of the window.
  185.     // ------------------------------------------------------------
  186.  
  187.     //    The view panes.
  188.     //
  189.     $gMainPane = `paneLayout -parent $gWorkAreaForm viewPanes`;
  190.  
  191.     //    The Toolbox.
  192.     //
  193.     $toolbox = `formLayout -parent $gWorkAreaForm`;
  194.  
  195.     //    The Attribute Editor.
  196.     //
  197.     $attributeEditor = `formLayout -parent $gWorkAreaForm`;
  198.  
  199.     //    The Attribute Editor.
  200.     //
  201.     $toolSettings = `formLayout -parent $gWorkAreaForm`;
  202.  
  203.     //    The combined Channel Box / Layer Editor area.
  204.     //
  205.     $channelsLayers = `formLayout -parent $gWorkAreaForm`;
  206.  
  207.     // ------------------------------------------------------------
  208.     //    Create the UI Component Bars.
  209.     // ------------------------------------------------------------
  210.     source "UIComponents.mel";
  211.  
  212.     createUIComponentBar("Maya Top Component Bar", "top");
  213.     createUIComponentBar("Maya Bottom Component Bar", "bottom");
  214.     createUIComponentBar("Maya Left Component Bar", "left");
  215.     createUIComponentBar("Maya Right Component Bar", "right");
  216.  
  217.     // ------------------------------------------------------------
  218.     //    Now create the UI component areas.
  219.     // ------------------------------------------------------------
  220.     //
  221.     //    Use the createUIComponent() procedure to create collapsable areas
  222.     //    for each component. Each collapsable component will have a visible
  223.     //    button for hiding the component.
  224.     //
  225.  
  226.     $gStatusLineForm = createUIComponent(
  227.         "Maya Top Component Bar", "Status Line", $statusLine);
  228.  
  229.     $gShelfForm = createUIComponent(
  230.         "Maya Top Component Bar", "Shelf", $shelf);
  231.  
  232.     $gTimeSliderForm = createUIComponent(
  233.         "Maya Bottom Component Bar", "Time Slider", $timeSlider);
  234.  
  235.     $gPlaybackRangeForm = createUIComponent(
  236.         "Maya Bottom Component Bar", "Range Slider", $playbackRange);
  237.  
  238.     $gCommandLineForm = createUIComponent(
  239.         "Maya Bottom Component Bar", "Command Line", $commandLine);
  240.  
  241.     $gHelpLineForm = createUIComponent(
  242.         "Maya Bottom Component Bar", "Help Line", $helpLine);
  243.  
  244.     $gMayaLiveControlForm = createUIComponent(
  245.         "Maya Bottom Component Bar", "Maya Live Control Panel", $mayaLive);
  246.  
  247.     $gToolboxForm = createUIComponent(
  248.         "Maya Left Component Bar", "Tool Box", $toolbox);
  249.  
  250.     $gAttributeEditorForm = createUIComponent(
  251.         "Maya Right Component Bar", "Attribute Editor", $attributeEditor);
  252.  
  253.     $gToolSettingsForm = createUIComponent(
  254.         "Maya Right Component Bar", "Tool Settings", $toolSettings);
  255.  
  256.     $gChannelsLayersForm = createUIComponent(
  257.         "Maya Right Component Bar", "Channel Box / Layer Editor", $channelsLayers);
  258.  
  259.     //    Specify the non-component areas.
  260.     //
  261.     setUIComponentWorkArea("Maya Top Component Bar", $gWorkAreaForm);
  262.  
  263.     setUIComponentWorkArea("Maya Bottom Component Bar", $gWorkAreaForm);
  264.  
  265.     setUIComponentWorkArea("Maya Left Component Bar", $gMainPane);
  266.  
  267.     setUIComponentWorkArea("Maya Right Component Bar", $gMainPane);
  268.  
  269.     // ------------------------------------------------------------
  270.  
  271.     //    Create a default cluster for any toolbox or shelf tools.
  272.     //
  273.     if (!`toolCollection -exists toolCluster`) {
  274.         toolCollection -global true toolCluster;
  275.     }
  276.  
  277.     formLayout -edit
  278.         -attachForm     $toolbox            "top"    0
  279.         -attachForm     $toolbox            "left"   0
  280.         -attachForm     $toolbox            "bottom" 0
  281.         -attachNone     $toolbox            "right"
  282.  
  283.         -attachForm     $gMainPane          "top"    0
  284.         -attachControl  $gMainPane          "left"   0 $toolbox
  285.         -attachForm     $gMainPane          "bottom" 0
  286.         -attachControl  $gMainPane          "right"  0 $attributeEditor
  287.  
  288.         -attachForm     $attributeEditor    "top"    0
  289.         -attachNone     $attributeEditor    "left"
  290.         -attachForm     $attributeEditor    "bottom" 0
  291.         -attachControl  $attributeEditor    "right"  0 $toolSettings
  292.  
  293.         -attachForm     $toolSettings       "top"    0
  294.         -attachNone     $toolSettings       "left"
  295.         -attachForm     $toolSettings       "bottom" 0
  296.         -attachControl  $toolSettings       "right"  0 $channelsLayers
  297.  
  298.         -attachForm     $channelsLayers     "top"    0
  299.         -attachNone     $channelsLayers     "left"
  300.         -attachForm     $channelsLayers     "bottom" 0
  301.         -attachForm     $channelsLayers     "right"  0
  302.  
  303.         $gWorkAreaForm;    
  304.  
  305.     //    Set up attachments for the main window components.
  306.     //
  307.     formLayout -edit
  308.         -attachForm     $statusLine          "top"    0
  309.         -attachForm     $statusLine          "left"   0  
  310.         -attachNone     $statusLine          "bottom"
  311.         -attachForm     $statusLine          "right"  0
  312.            
  313.         -attachControl  $shelf               "top"    2 $statusLine
  314.         -attachForm     $shelf               "left"   0 
  315.         -attachNone     $shelf               "bottom"
  316.         -attachForm     $shelf               "right"  0
  317.         
  318.         -attachControl  $gWorkAreaForm       "top"    0 $shelf
  319.         -attachForm     $gWorkAreaForm       "left"   0
  320.         -attachControl  $gWorkAreaForm       "bottom" 0 $mayaLive
  321.         -attachForm     $gWorkAreaForm       "right"  0
  322.  
  323.         -attachNone     $mayaLive            "top"
  324.         -attachForm     $mayaLive            "left"   0 
  325.         -attachForm     $mayaLive            "right"  0 
  326.         -attachControl  $mayaLive            "bottom" 0 $timeSlider
  327.               
  328.         -attachNone     $timeSlider          "top"
  329.         -attachForm     $timeSlider          "left"   0 
  330.         -attachForm     $timeSlider          "right"  0 
  331.         -attachControl  $timeSlider          "bottom" 0 $playbackRange
  332.               
  333.         -attachNone     $playbackRange       "top"
  334.         -attachForm     $playbackRange       "left"   0 
  335.         -attachForm     $playbackRange       "right"  0 
  336.         -attachControl  $playbackRange       "bottom" 0 $commandLine
  337.               
  338.         -attachNone     $commandLine         "top"
  339.         -attachForm     $commandLine         "left"   0 
  340.         -attachForm     $commandLine         "right"  0
  341.         -attachControl  $commandLine         "bottom" 0 $helpLine
  342.  
  343.         -attachNone     $helpLine            "top"    
  344.         -attachForm     $helpLine            "left"   0
  345.         -attachForm     $helpLine            "bottom" 0
  346.         -attachForm     $helpLine            "right"  0 
  347.  
  348.         $gMainWindowForm;
  349. }
  350.